package fr.insta.browser.domain;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>StateOnStart class.</p>
 *
 * @author Once
 * @version $Id: $Id
 */
public enum StateOnStart 
{
	LAUNCH_HOME ("Afficher ma page d'accueil"), 
	LAUNCH_LAST_TABS ("Afficher les derniers onglets utilisés");

	private String label = "";

	StateOnStart(String _label)
	{
		this.label = _label;
	}

	/**
	 * <p>Getter for the field <code>label</code>.</p>
	 *
	 * @return a {@link java.lang.String} object.
	 */
	public String getLabel()
	{
		return this.label;
	}

	/**
	 * <p>getValue.</p>
	 *
	 * @param _label a {@link java.lang.String} object.
	 * @return a {@link fr.insta.browser.domain.StateOnStart} object.
	 */
	public static StateOnStart getValue(final String _value)
	{
		StateOnStart etat = null;
		for(final StateOnStart item : StateOnStart.values())
		{
			if(item.getLabel().equals(_value))
			{
				etat = item;
				break;
			}
		}
		return etat;
	}

	/**
	 * <p>labels.</p>
	 *
	 * @return an array of {@link java.lang.Object} objects.
	 */
	public static Object [] labels()
	{
		List <String> labels = new ArrayList<String>();
		for(StateOnStart s : StateOnStart.values())
		{
			labels.add(s.getLabel());
		}
		return labels.toArray();
	}

	/** {@inheritDoc} */
	@Override
	public String toString()
	{
		StringBuilder str = new StringBuilder("StateOnStart \n Valeurs : \n");
		for(StateOnStart s : StateOnStart.values())
		{
			str.append(s.getLabel());
			str.append("\n");
		}
		return str.toString();
	}
}
